Bug 538395 – gtk_combo_box_append_text() on non-compliant model
authorMichael Natterer <mitch@imendio.com>
Fri, 20 Jun 2008 10:00:40 +0000 (10:00 +0000)
committerMichael Natterer <mitch@src.gnome.org>
Fri, 20 Jun 2008 10:00:40 +0000 (10:00 +0000)
2008-06-20  Michael Natterer  <mitch@imendio.com>

Bug 538395 – gtk_combo_box_append_text() on non-compliant model
segfaults

* gtk/gtkcombobox.c (gtk_combo_box_append_text)
(gtk_combo_box_insert_text)
(gtk_combo_box_prepend_text)
(gtk_combo_box_remove_text)
(gtk_combo_box_real_get_active_text): apply patch from Christian
Dywan which adds the needed g_return_if_fail() to prevent the
crashes.

svn path=/trunk/; revision=20477

ChangeLog
gtk/gtkcombobox.c

index 97174f15db0d731828af9e2551d4d764725f3f42..c2c14ffdf8334a414de6f3b05dc1a7cd9c301855 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-06-20  Michael Natterer  <mitch@imendio.com>
+
+       Bug 538395 – gtk_combo_box_append_text() on non-compliant model
+       segfaults
+
+       * gtk/gtkcombobox.c (gtk_combo_box_append_text)
+       (gtk_combo_box_insert_text)
+       (gtk_combo_box_prepend_text)
+       (gtk_combo_box_remove_text)
+       (gtk_combo_box_real_get_active_text): apply patch from Christian
+       Dywan which adds the needed g_return_if_fail() to prevent the
+       crashes.
+
 2008-06-20  Cody Russell  <cody@jhu.edu>
 
        * gdk/directfb/gdkwindow-directfb.c:
index b30226776cb19fa6e50f955b4eb7d9facd0f7cc0..d1edf688db2b85151499cbdac5325786278b60b2 100644 (file)
@@ -5023,6 +5023,8 @@ gtk_combo_box_append_text (GtkComboBox *combo_box,
 
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
   g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
+  g_return_if_fail (gtk_tree_model_get_column_type (combo_box->priv->model, 0)
+                   == G_TYPE_STRING);
   g_return_if_fail (text != NULL);
 
   store = GTK_LIST_STORE (combo_box->priv->model);
@@ -5054,6 +5056,8 @@ gtk_combo_box_insert_text (GtkComboBox *combo_box,
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
   g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
   g_return_if_fail (position >= 0);
+  g_return_if_fail (gtk_tree_model_get_column_type (combo_box->priv->model, 0)
+                   == G_TYPE_STRING);
   g_return_if_fail (text != NULL);
 
   store = GTK_LIST_STORE (combo_box->priv->model);
@@ -5082,6 +5086,8 @@ gtk_combo_box_prepend_text (GtkComboBox *combo_box,
 
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
   g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
+  g_return_if_fail (gtk_tree_model_get_column_type (combo_box->priv->model, 0)
+                   == G_TYPE_STRING);
   g_return_if_fail (text != NULL);
 
   store = GTK_LIST_STORE (combo_box->priv->model);
@@ -5109,6 +5115,8 @@ gtk_combo_box_remove_text (GtkComboBox *combo_box,
 
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
   g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
+  g_return_if_fail (gtk_tree_model_get_column_type (combo_box->priv->model, 0)
+                   == G_TYPE_STRING);
   g_return_if_fail (position >= 0);
 
   store = GTK_LIST_STORE (combo_box->priv->model);
@@ -5153,6 +5161,8 @@ gtk_combo_box_real_get_active_text (GtkComboBox *combo_box)
   gchar *text = NULL;
 
   g_return_val_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model), NULL);
+  g_return_val_if_fail (gtk_tree_model_get_column_type (combo_box->priv->model, 0)
+                        == G_TYPE_STRING, NULL);
 
   if (gtk_combo_box_get_active_iter (combo_box, &iter))
     gtk_tree_model_get (combo_box->priv->model, &iter,